home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1998 July
/
EnigmA AMIGA RUN 29 (1998)(G.R. Edizioni)(IT)[!][issue 1998-07 & 08].iso
/
earkit
/
browser
/
ibrowsescripts
/
rexx
/
allmail.ibrx
next >
Wrap
Text File
|
1998-05-24
|
4KB
|
131 lines
/*Read Yams mail whith IBrowse
fixa så man kan välja bort requestern vid autoyam (ingen ibrowse startad)
lägga in check att yam är igång, om inte starta
kopiering av bilder till ram:t inget felmedelande om mailback.iff saknas
kolla att allmail och new har olika filer?? eller kanske inte?
*/
OPTIONS RESULTS
NL='0a'x /* newline */
NLNL='0a0a'x /* 2 newlines */
fileinc='<B><IMG SRC="mailfile.iff" ALT="File/s included!" > </B>'
repl='<B><IMG SRC="mailrep.iff" ALT="Replyed!" > </B>'
new='<B><IMG SRC="mailnew.iff" ALT="new" > </B>'
fresh='<B><IMG SRC="mailfresh.iff" ALT="fresh" > </B>'
rubrik='<HTML><CENTER><B><FONT COLOR="#FF0000"><BIG>Here are your mail !</BIG></FONT></B></CENTER><PRE>'||NL
/* <PRE><BIG> Here are your mail.</BIG>'||NL */
IF ~SHOW('Ports','YAM') THEN DO
ADDRESS 'COMMAND'
'Run >NIL: YAM:YAM HIDE'
'SYS:RexxC/WaitForPort YAM'
END
IF ~EXISTS('RAM:T/new.iff') THEN DO
ADDRESS 'COMMAND'
'copy IBrowse:Rexx/mailfile.iff ram:t/'
'copy IBrowse:Rexx/mailfresh.iff ram:t/'
'copy IBrowse:Rexx/mailrep.iff ram:t/'
'copy IBrowse:Rexx/mailnew.iff ram:t/'
IF EXISTS('IBrowse:Rexx/mailback.iff') THEN 'copy IBrowse:Rexx/mailback.iff ram:t/ >NIL:'
END
IF SHOW('Ports','IBROWSE') THEN DO
ADDRESS YAM
SetFolder 0
GetFolderinfo MAX; max=RESULT
a=0
app=''
linkpage='<HEAD><TITLE>AllMail by Sören Forsberg</TITLE></HEAD><BODY><BODY BGCOLOR="#F0F0F0"><BODY BACKGROUND="mailback.iff"></BODY>'||rubrik
DO WHILE a<max
setmail a
getmailinfo STA
status=result
getmailinfo FRO
from=result
getmailinfo SUB
subject=result
subject=LEFT(subject,30)
getmailinfo FIL
file=result
namepos=pos('<',from)
name=LEFT(from,namepos-1)
name=LEFT(name,30)
lenfrom=LENGTH(from)
email=SUBSTR(from,namepos+1,lenfrom-namepos-1)
mailto='<A HREF="mailto:'||email||'">'||email||'</A>'||NL
titel='From: '||name||'Subject: '||subject
open('inputfile',file,'R')
b=1
list=''
DO FOREVER
line=readln('inputfile')
appex=pos('application/octet-stream',line)
IF appex~=0 then BREAK
list=list||line||NL
IF EOF('inputfile') THEN BREAK
END
close('inputfile')
linkpage=linkpage||'<A HREF="file://localhost/RAM:T/newmail'||a||'.html">'||titel||'</A>'
if status='N' then titel=titel||fresh
if status='N' then linkpage=linkpage||fresh
if status='R' then titel=titel||repl
if status='U' then titel=titel||new
if status='R' then linkpage=linkpage||repl
if status='U' then linkpage=linkpage||new
if appex~=0 then titel=titel||fileinc
if appex~=0 then linkpage=linkpage||fileinc
linkpage=linkpage||NL
len=length(list)
texttype='text/plain'
htmlpos=pos('text/html',list)
IF htmlpos~=0 THEN texttype='text/html'
textpos=pos(texttype,list)
IF textpos=0 THEN textpos=pos('X-UIDL:',list)
startpos=pos(NLNL,list,textpos)
out =substr(list,startpos,len-startpos)
endpos=pos('boundary=',list)
if endpos~=0 THEN DO
outlen=LENGTH(out)
boundary=SUBSTR(list,endpos+10,24)
endpos=pos(boundary,out)
endpos=lastpos(NL,out,endpos)
out=LEFT(out,endpos)
END
open('outputfile','RAM:T/newmail'a'.html','W')
line=writeln('outputfile','<BODY><BODY BGCOLOR="#F0F0F0"></BODY><PRE>'||titel)
line=writeln('outputfile','Mail to: '||mailto)
IF htmlpos~=0 THEN line=writeln('outputfile','</PRE>')
line=writeln('outputfile',out)
IF htmlpos=0 THEN line=writeln('outputfile','</PRE>')
close('outputfile')
a=a+1
END
linkpage=linkpage||'</PRE>'
open('outputfile','RAM:T/newmail.html','W')
line=writeln('outputfile',linkpage)
close('outputfile')
ADDRESS 'IBROWSE'
GOTOURL URL 'file://localhost/RAM:T/newmail.html'
END
IF ~SHOW('Ports','IBROWSE') THEN DO
/* lägga in en requester There is new mail for you! OK! */
ADDRESS 'YAM'
show
setfolder 0
END
exit